package com.ddz.implementation;

import java.util.List;

import android.content.Context;
import android.graphics.Point;
import android.os.Build.VERSION;
import android.view.View;

import com.ddz.interfaces.IInput;

public class Input implements IInput {
	TouchHandler mTouchHandler;

	public Input(Context context, View view, float scaleX, float scaleY) {
		if(VERSION.SDK_INT < 5)
			mTouchHandler = new SingleTouchHandler(view, scaleX, scaleY);
		else
			mTouchHandler = new MultiTouchHandler(view, scaleX, scaleY);
	}

	@Override
	public boolean isTouchDown(int pointer) {
		return mTouchHandler.isTouchDown(pointer);
	}

	@Override
	public int getTouchX(int pointer) {
		return mTouchHandler.getTouchX(pointer);
	}

	@Override
	public int getTouchY(int pointer) {
		return mTouchHandler.getTouchY(pointer);
	}

	@Override
	public Point getTouchPos(int pointer) {
		return new Point(getTouchX(pointer), getTouchY(pointer));
	}

	@Override
	public List<TouchEvent> getTouchEvents() {
		return mTouchHandler.getTouchEvents();
	}

}
